package com.agricultural.robot.controller;

import com.agricultural.robot.model.Field;
import com.agricultural.robot.model.Path;
import com.agricultural.robot.strategy.PathStrategy;

/**
 * 路径规划器
 */
public class PathPlanner {
    private PathStrategy strategy;

    public void setStrategy(PathStrategy strategy) {
        this.strategy = strategy;
    }

    public Path planPath(Field field, String startPoint, String endPoint) {
        if (strategy == null) {
            throw new IllegalStateException("未设置路径规划策略");
        }
        return strategy.planPath(field, startPoint, endPoint);
    }
}
